package net.kazed.nextaction.database;

import java.util.ArrayList;
import java.util.List;

public class TreeNode<T> {

   private TreeNode<T> parentNode;
   private T data;
   private List<TreeNode<T>> children;
   
//   /**
//    * Constructor.
//    * @param parentNode Parent of this node.
//    * @param children Children of this node.
//    */
//   public TreeNode(TreeNode<T> parentNode, List<TreeNode<T>> children) {
//      super();
//      this.parentNode = parentNode;
//      this.children = children;
//   }

   /**
    * Constructor.
    * @param parentNode Parent of this node.
    * @param data Data contained in this node.
    */
   public TreeNode(TreeNode<T> parentNode, T data) {
      super();
      this.parentNode = parentNode;
      this.children = new ArrayList<TreeNode<T>>();
      this.data = data;
   }
   
   /**
    * Add child node.
    * @param node Add this child node.
    */
   public void addChild(TreeNode<T> node) {
      children.add(node);
   }

   /**
    * @return The data
    */
   public T getData() {
      return data;
   }

   /**
    * @return Parent of this node.
    */
   public TreeNode<T> getParentNode() {
      return parentNode;
   }

   /**
    * @return Children of this node.
    */
   public List<TreeNode<T>> getChildren() {
      return children;
   }
   
}
